/*
 * MIT License
 * 
 * Copyright (c) 2017 wen.gu <454727014@qq.com>
 * 
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

/***************************************************************************
 * Name: vos_version.h
 *
 * Purpose: about version struct and interface define
 *
 * Developer:
 *   wen.gu , 2014-06-07
 *
 * TODO: 
 *
 ***************************************************************************/

#ifndef __VOS_VERSION_H__
#define __VOS_VERSION_H__

#include "general_type.h"

#ifdef __cplusplus
extern "C"{
#endif
/***************************************************************************
 *
 * macro declaration
 *
 ***************************************************************************/
#define VOS_MAJOR_VERSION_NUM      0
#define VOS_MINOR_VERSION_NUM      1
#define VOS_REVISION_VERSION_NUM   0
#define VOS_STEP_VERSION_NUM       0


#define VOS_RELEASE_DAY            7
#define VOS_RELEASE_MONTH          9
#define VOS_RELEASE_YEAR           2015

/***************************************************************************
 *
 * data struct declaration
 *
 ***************************************************************************/
typedef union vosVersion_u
{
    struct
    {
        GU08 nVersionMajor;   /**< Major version accessor element */
        GU08 nVersionMinor;   /**< Minor version accessor element */
        GU08 nRevision;       /**< Revision version accessor element */
        GU08 nStep;           /**< Step version accessor element */
    } s;
    GU32 nVersion;           /**< 32 bit value to make accessing the
                                    version easily done in a single word
                                    size copy/compare operation */
}vosVersion_t;

typedef union vosReleaseDate_u
{
    struct MyStruct
    {
        GU08 nDay;   /**< the day of release date */
        GU08 nMonth; /**< the month of release date */
        GU16 nYear;  /**< the year of release date */
    }s;
    GU32 nReleaseDate;  /**< 32bit value to makeaccessing the
                             release date easily done in a single word
                             size copy/compare operation */
}vosReleaseDate_t;

/***************************************************************************
*
* API declaration
*
***************************************************************************/

/*
 *@brief get vos version information
 *@param None.
 *@return vos version information
 *
 **/
G_API vosVersion_t vosGetVersion(void);

/*
 *@brief get vos version major number
 *@param None.
 *@return vos version major number
 *
 **/
G_API GU08 vosGetVersionMajor(void);

/*
 *@brief get vos version minor number
 *@param None.
 *@return vos version minor number
 *
 **/
G_API GU08 vosGetVersionMinor(void);

/*
 *@brief get vos version revision number
 *@param None.
 *@return vos version revision number
 *
 **/
G_API GU08 vosGetVersionRevision(void);

/*
 *@brief get vos version step number
 *@param None.
 *@return vos version step number
 *
 **/
G_API GU08 vosGetVersionStep(void);

/*
 *@brief check vos version at least is some value
 *@param major    [in] version major number.
 *@param minor    [in] version minor number.
 *@param revision [in] version revision number.
 *@param step     [in] version step number.
 *@return true:return GTRUE, else return GFALSE.
 *
 **/
G_API GBOL vosIsVersionAtLeast(GU08 major, GU08 minor, GU08 revision, GU08 step);

//////////////////////////////////////////////////////////////////////////
/*
 *@brief get vos release date
 *@param None.
 *@return vos release date
 *
 **/
G_API vosReleaseDate_t vosGetReleaseDate(void);

/*
 *@brief get vos release day
 *@param None.
 *@return vos release day
 *
 **/
G_API GU08 vosGetReleaseDay(void);

/*
 *@brief get vos release month
 *@param None.
 *@return vos release month
 *
 **/
G_API GU08 vosGetReleaseMonth(void);

/*
 *@brief get vos release year
 *@param None.
 *@return vos release year
 *
 **/
G_API GU16 vosGetReleaseYear(void);

/*
*@brief check vos release date at least is some value
*@param year   [in] version major number.
*@param month  [in] version minor number.
*@param day    [in] version revision number.
*@return true:return GTRUE, else return GFALSE.
*
**/
G_API GBOL vosIsDateAtLeast(GU16 year, GU08 month, GU08 day);

//////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////// 

/*
 *@brief get vos build information(eg. build date, commit info...)
 *@param None.
 *@return vos build inforamtion
 *
 **/
G_API const char* vosGetBuildInfo(void);

#ifdef __cplusplus
}
#endif
#endif //end of __VOS_VERSION_H__
